package com.utils.db;

import java.util.Map;

/**
 * 实际调用参数
 *
 * @author: dingjiejun
 * @version: 1.0
 * @date: 2018/2/28
 */
public class SqlArgument {

    private String text;

    private Object[] args;

    private boolean namedQuery;

    private Map<String,Object> paramMap;

    private String[] paramNames;

    private Object[] paramValues;

    public SqlArgument() {
        this.namedQuery = false;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    public Object[] getArgs() {
        return args;
    }

    public void setArgs(Object[] args) {
        this.args = args;
    }

    public boolean isNamedQuery() {
        return namedQuery;
    }

    public void setNamedQuery(boolean namedQuery) {
        this.namedQuery = namedQuery;
    }

    public Map<String, Object> getParamMap() {
        return paramMap;
    }

    public void setParamMap(Map<String, Object> paramMap) {
        this.paramMap = paramMap;
        int size = paramMap.size();
        this.paramNames  = new String[size];
        this.paramValues  = new Object[size];
        int i = 0;
        for (Map.Entry<String, Object> entry : paramMap.entrySet()) {
            this.paramNames[i] = entry.getKey();
            this.paramValues[i] = entry.getValue();
            i++;
        }
    }

    public String[] getParamNames() {
        return paramNames;
    }

    public Object[] getParamValues() {
        return paramValues;
    }
}
